﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace MVCSiteJDG.Dao.DataAccess
{
    public class Deleter
    {
        //public static void deleteApplication(string Id)
        //{
        //    try
        //    {
        //         System.Data.OleDb.OleDbConnection connection = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;Data Source= |DataDirectory|\\MyDatabase#1.sdf");
        //        System.Data.OleDb.OleDbCommand command = new System.Data.OleDb.OleDbCommand("delete application where id =" + Id +"");

        //        connection.Open();
        //        command.ExecuteNonQuery();
                
        //    }
        //    catch (Exception)
        //    {
                
        //    }
        //}
        public static void deleteAccount(string accountID)
        {
            //try
            //{
                 System.Data.OleDb.OleDbConnection connection = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;Data Source= |DataDirectory|\\MyDatabase#1.sdf");
                 System.Data.OleDb.OleDbCommand command = new System.Data.OleDb.OleDbCommand("delete from account where accountID =" + accountID, connection);

                connection.Open();
                command.ExecuteNonQuery();
                connection.Close();
            //}
            //catch (Exception)
            //{

            //}
        }
        public static void deleteAsset(string assetID)
        {
            //try
            //{
                 System.Data.OleDb.OleDbConnection connection = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;Data Source= |DataDirectory|\\MyDatabase#1.sdf");
                 System.Data.OleDb.OleDbCommand command = new System.Data.OleDb.OleDbCommand("delete from asset where assetID =" + assetID, connection);

                connection.Open();
                command.ExecuteNonQuery();
                connection.Close();
            //}
            //catch (Exception)
            //{

            //}
        }
        public static void deleteCartItem(string cartItemID)
        {
            //try
            //{
                 System.Data.OleDb.OleDbConnection connection = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;Data Source= |DataDirectory|\\MyDatabase#1.sdf");
                 System.Data.OleDb.OleDbCommand command = new System.Data.OleDb.OleDbCommand("delete from cartitem where cartItemID =" + cartItemID, connection);

                connection.Open();
                command.ExecuteNonQuery();
                connection.Close();
            //}
            //catch (Exception)
            //{

            //}
        }
        public static void deleteCatalog(string catID)
        {
            //try
            //{
                 System.Data.OleDb.OleDbConnection connection = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;Data Source= |DataDirectory|\\MyDatabase#1.sdf");
                 System.Data.OleDb.OleDbCommand command = new System.Data.OleDb.OleDbCommand("delete from catalog where catID =" + catID, connection);

                connection.Open();
                command.ExecuteNonQuery();
                connection.Close();
            //}
            //catch (Exception)
            //{

            //}
        }
        //public static void deleteCatalogProduct(string Id)
        //{
        //    try
        //    {
        //         System.Data.OleDb.OleDbConnection connection = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;Data Source= |DataDirectory|\\MyDatabase#1.sdf");
        //        System.Data.OleDb.OleDbCommand command = new System.Data.OleDb.OleDbCommand("delete from catalogproduct where id =" + Id + "");

        //        connection.Open();
        //        command.ExecuteNonQuery();

        //    }
        //    catch (Exception)
        //    {

        //    }
        //}
        public static void deleteCostCentre(string costCentreID)
        {
            //try
            //{
                 System.Data.OleDb.OleDbConnection connection = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;Data Source= |DataDirectory|\\MyDatabase#1.sdf");
                 System.Data.OleDb.OleDbCommand command = new System.Data.OleDb.OleDbCommand("delete from costcentre where costCentreID =" + costCentreID, connection);

                connection.Open();
                command.ExecuteNonQuery();
                connection.Close();
            //}
            //catch (Exception)
            //{

            //}
        }
        public static void deleteDepartment(string departmentID)
        {
            //try
            //{
                 System.Data.OleDb.OleDbConnection connection = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;Data Source= |DataDirectory|\\MyDatabase#1.sdf");
                 System.Data.OleDb.OleDbCommand command = new System.Data.OleDb.OleDbCommand("delete from department where departmentID =" + departmentID, connection);

                connection.Open();
                command.ExecuteNonQuery();
                connection.Close();
            //}
            //catch (Exception)
            //{

            //}
        }
        //public static void deleteEmployee(string Id)
        //{
        //    try
        //    {
        //         System.Data.OleDb.OleDbConnection connection = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;Data Source= |DataDirectory|\\MyDatabase#1.sdf");
        //        System.Data.OleDb.OleDbCommand command = new System.Data.OleDb.OleDbCommand("delete from employee where id =" + Id + "");

        //        connection.Open();
        //        command.ExecuteNonQuery();

        //    }
        //    catch (Exception)
        //    {

        //    }
        //}
        public static void deleteLog(string logID)
        {
            //try
            //{
                 System.Data.OleDb.OleDbConnection connection = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;Data Source= |DataDirectory|\\MyDatabase#1.sdf");
                 System.Data.OleDb.OleDbCommand command = new System.Data.OleDb.OleDbCommand("delete from log where logID =" + logID, connection);

                connection.Open();
                command.ExecuteNonQuery();
                connection.Close();
            //}
            //catch (Exception)
            //{

            //}
        }
        public static void deleteMainCategory(string mainCategoryID)
        {
            //try
            //{
                 System.Data.OleDb.OleDbConnection connection = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;Data Source= |DataDirectory|\\MyDatabase#1.sdf");
                 System.Data.OleDb.OleDbCommand command = new System.Data.OleDb.OleDbCommand("delete from MainCategory where mainCategoryID =" + mainCategoryID, connection);

                connection.Open();
                command.ExecuteNonQuery();
                connection.Close();

            //}
            //catch (Exception)
            //{

            //}
        }
        public static void deleteOrders(string orderID)
        {
            //try
            //{
                 System.Data.OleDb.OleDbConnection connection = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;Data Source= |DataDirectory|\\MyDatabase#1.sdf");
                 System.Data.OleDb.OleDbCommand command = new System.Data.OleDb.OleDbCommand("delete from orders where orderID =" + orderID, connection);

                connection.Open();
                command.ExecuteNonQuery();
                connection.Close();

            //}
            //catch (Exception)
            //{

            //}
        }
        public static void deleteOrderLineItem(string orderLineID)
        {
            //try
            //{
                 System.Data.OleDb.OleDbConnection connection = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;Data Source= |DataDirectory|\\MyDatabase#1.sdf");
                 System.Data.OleDb.OleDbCommand command = new System.Data.OleDb.OleDbCommand("delete from orderlineitem where orderLineID =" + orderLineID, connection);

                connection.Open();
                command.ExecuteNonQuery();
                connection.Close();

            //}
            //catch (Exception)
            //{

            //}
        }
        //public static void deleteOrderStatus(string Id)
        //{
        //    try
        //    {
        //         System.Data.OleDb.OleDbConnection connection = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;Data Source= |DataDirectory|\\MyDatabase#1.sdf");
        //        System.Data.OleDb.OleDbCommand command = new System.Data.OleDb.OleDbCommand("delete orderStatus where id =" + Id + "");

        //        connection.Open();
        //        command.ExecuteNonQuery();

        //    }
        //    catch (Exception)
        //    {

        //    }
        //}
        public static void deleteProduct(string productID)
        {
            //try
            //{
                 System.Data.OleDb.OleDbConnection connection = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;Data Source= |DataDirectory|\\MyDatabase#1.sdf");
                 System.Data.OleDb.OleDbCommand command = new System.Data.OleDb.OleDbCommand("delete from product where productID =" + productID, connection);

                connection.Open();
                command.ExecuteNonQuery();
                connection.Close();

            //}
            //catch (Exception)
            //{

            //}
        }
        public static void deleteRequest(string requestID)
        {
            //try
            //{
                 System.Data.OleDb.OleDbConnection connection = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;Data Source= |DataDirectory|\\MyDatabase#1.sdf");
                 System.Data.OleDb.OleDbCommand command = new System.Data.OleDb.OleDbCommand("delete from Request where requestID =" + requestID, connection);

                connection.Open();
                command.ExecuteNonQuery();
                connection.Close();

            //}
            //catch (Exception)
            //{

            //}
        }
        public static void deleteReview(string reviewID)
        {
            //try
            //{
                 System.Data.OleDb.OleDbConnection connection = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;Data Source= |DataDirectory|\\MyDatabase#1.sdf");
                 System.Data.OleDb.OleDbCommand command = new System.Data.OleDb.OleDbCommand("delete from review where reviewID =" + reviewID, connection);

                connection.Open();
                command.ExecuteNonQuery();
                connection.Close();

            //}
            //catch (Exception)
            //{

            //}
        }
        public static void deleteShoppingCart(string cartID)
        {
            //try
            //{
                 System.Data.OleDb.OleDbConnection connection = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;Data Source= |DataDirectory|\\MyDatabase#1.sdf");
                 System.Data.OleDb.OleDbCommand command = new System.Data.OleDb.OleDbCommand("delete from ShoppingCart where cartID =" + cartID, connection);

                connection.Open();
                command.ExecuteNonQuery();
                connection.Close();

            //}
            //catch (Exception)
            //{

            //}
        }
        public static void deleteShoppingHistory(string shoppingHistoryID)
        {
            //try
            //{
                 System.Data.OleDb.OleDbConnection connection = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;Data Source= |DataDirectory|\\MyDatabase#1.sdf");
                 System.Data.OleDb.OleDbCommand command = new System.Data.OleDb.OleDbCommand("delete from ShoppingHistory where shoppingHistoryID =" + shoppingHistoryID, connection);

                connection.Open();
                command.ExecuteNonQuery();
                connection.Close();

            //}
            //catch (Exception)
            //{

            //}
        }
        public static void deleteSubCategory(string subCategoryID)
        {
            //try
            //{
                 System.Data.OleDb.OleDbConnection connection = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;Data Source= |DataDirectory|\\MyDatabase#1.sdf");
                 System.Data.OleDb.OleDbCommand command = new System.Data.OleDb.OleDbCommand("delete from SUBCATEGORY where subCategoryID =" + subCategoryID, connection);

                connection.Open();
                command.ExecuteNonQuery();
                connection.Close();

            //}
            //catch (Exception)
            //{

            //}
        }
        public static void deleteSupplier(string supplierID)
        {
            //try
            //{
                 System.Data.OleDb.OleDbConnection connection = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;Data Source= |DataDirectory|\\MyDatabase#1.sdf");
                 System.Data.OleDb.OleDbCommand command = new System.Data.OleDb.OleDbCommand("delete from supplier where supplierID =" + supplierID, connection);

                connection.Open();
                command.ExecuteNonQuery();
                connection.Close();

            //}
            //catch (Exception)
            //{

            //}
        }
        public static void deleteTechnician(string technicianID)
        {
            //try
            //{
                 System.Data.OleDb.OleDbConnection connection = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;Data Source= |DataDirectory|\\MyDatabase#1.sdf");
                 System.Data.OleDb.OleDbCommand command = new System.Data.OleDb.OleDbCommand("delete from technician where technicianID =" + technicianID, connection);

                connection.Open();
                command.ExecuteNonQuery();
                connection.Close();

            //}
            //catch (Exception)
            //{

            //}
        }
    }
}